{* $Id$ *}
{include_core file="admin/lib/header.html" title="版本内容编辑"}
<div class="page-header border-bottom clearfix">
    <h2 class="left">应用版本管理<span>{if $info.id}修改{else}添加{/if}版本</span></h2>
    <a href="{AnUrl('version/admin')}" class="btn btn-default btn-sm right">&lt;&nbsp;返回列表</a>
</div>
<!--start:用户新增-->
<div class="add-form">
    <form class="js_creatForm" action="{AnUrl('version/admin/save')}" method="post" enctype="multipart/form-data">
        <input type="hidden" name="id" value="{$info.id}"/>
        <table class="table" cellpadding="0" cellspacing="0">
            <tr>
                <th><label for="" class="add-f-label">所属app平台：</label></th>
                <td>
                    <select class="add-f-slt1 js_role" name="info[type]">
                        {html_options options=$app_type_list selected =$info.type}
                    </select>
                </td>
            </tr>
            <tr>
                <th><label for="" class="add-f-label">所属app类型：</label></th>
                <td>
                    <select class="add-f-slt1 js_role" name="info[res_name]">
                        <option value="">请选择类型</option>
                        {html_options options=$app_res_list selected =$info.res_name }
                    </select>
                    <div class="tips"><span style="line-height: 34px;color: #f00;margin-right: 10px;">*</span>选择类型
                    </div>
                </td>
            </tr>

            <tr>
                <th><label for="" class="add-f-label">版本号：</label></th>
                <td>
                    <input name="info[version_no]" style="width:490px;" type="text" value="{$info.version_no}"
                           class="add-f-ipt1 js_mobile">
                    <div class="tips"><span style="line-height: 34px;color: #f00;margin-right: 10px;">*</span>输入版本号
                    </div>
                </td>
            </tr>
            <tr>
                <th><label for="" class="add-f-label">下载链接：</label></th>
                <td>
                    <input style="width:490px;" name="info[link]" type="text" value="{$info.link}"
                           placeholder="以http或https开头的完整链接" class="add-f-ipt1 js_password">
                    <div class="tips"><span style="line-height: 34px;color: #f00;margin-right: 10px;">*</span>输入密码</div>
                </td>
            </tr>
            <tr>
                <th><label for="" class="add-f-label">更新说明：</label></th>
                <td>
                    <textarea resize="no" class="js_desc" name="info[txt_desc]" style="width:370px;height:120px;">{$info.txt_desc}</textarea>
                    <div class="tips"><span style="line-height: 34px;color: #f00;margin-right: 10px;">*</span>再次输入密码
                    </div>
                </td>
            </tr>
            <tr>
                <th><label for="" class="add-f-label">发布时间：</label></th>
                <td>
                    <input id="start_time" class="js_time" name="info[update_time]" value="{$info.update_time}"
                           style="width:490px;" type="text" class="add-f-ipt1 js_rePassword">
                    <div class="tips"><span style="line-height: 34px;color: #f00;margin-right: 10px;">*</span>发布时间</div>
                </td>
            </tr>
            <tr>
                <th>&nbsp;</th>
                <td class="noborder">
                    <button type="submit" class="btn btn-success js_submit">
                        &nbsp;&nbsp;&nbsp;确认&nbsp;&nbsp;&nbsp;</button>
                </td>
            </tr>
        </table>
    </form>
</div>
<!--end:用户新增-->
<script>
    $(function () {
        // 提交验证
        $('.js_submit').click(function (e) {
            e.preventDefault();

            var form = $(this).closest('form');
            var data = {};
            form.serializeArray().forEach(function (item) {
                data[item.name] = item.value;
            });

            var check = ['type', 'res_name', 'version_no', 'link', 'txt_desc', 'update_time'];

            var name = '';
            for (var i in check) {
                if (check.hasOwnProperty(i)) {
                    name = 'info[' + check[i] + ']';
                    if ($.trim(data[name]) == '') {
                        $('[name="' + name + '"]').effect('highlight');
                        return false;
                    }
                }
            }

            form.submit();
        });
    });

</script>
{include_core file="admin/lib/footer.html"}